#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QList>

#define SUCCESS 0
#define FAILURE -1

namespace Ui {
class EncoderWindow;
}

class QTextCodec;
class QFileInfo;
class QMenu;
class QAction;

class EncoderWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit EncoderWindow(QWidget *parent = 0);
    ~EncoderWindow();

protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dragLeaveEvent(QDragLeaveEvent *event);
    void dropEvent(QDropEvent *event);
    
private:
    void createMenu();
    void initCodec();
    void highightSrcDir(bool);
    int encodeFile(const QFileInfo &,const QFileInfo &);
    QString selectDir();

    QList<QTextCodec *> codecList;
    QString lastDir;
    Ui::EncoderWindow *ui;

    QAction *exitAct;
    QAction *aboutAct;
    QAction *aboutQtAct;

    QMenu *fileMenu;
    QMenu *helpMenu;

private slots:
    void selectSrcDir();
    void selectDestDir();
    void encodeDir();
    void about();
    void start();
    void complete(int rst);

signals:
    void EncodeStarted();
    void EncodeCompleted(int rst);

};

#endif // MAINWINDOW_H
